package com.excel.validators.core.decorative;

import java.lang.reflect.Field;

@SuppressWarnings({"rawtypes"})
public final class FieldElement {

	/**
	 * 字段名称
	 */
	private String fieldName;
	
	/*
	 * 输出列名
	 */
	private String columnName;

	/**
	 * 字段对应excel中的列
	 */
	private Integer fieldIndex;
	
	/**
	 * 基本类型
	 */
	private int basicClass;
	
	/**
	 * 日期正则表达式
	 */
	private String pattern;
	
	/**
	 * 小数位数
	 */
	private Integer decimal;
	
	/**
	 * 反射字段
	 */
	private Field reflect;

	public FieldElement(int basicType, String fieldName, String columnName,
			int fieldIndex, String pattern, Integer decimal) {
			this.fieldName = fieldName;
			this.columnName = columnName;
			this.fieldIndex = fieldIndex;
			this.pattern = pattern;
			this.decimal = decimal;
			this.basicClass = basicType;
	}

	public int getBasicClass() {
			return basicClass;
	}
	
	public String getFieldName() {
			return fieldName;
	}

	public String getColumnName() {
			return columnName;
	}
	
	public Integer getFieldIndex() {
			return fieldIndex;
	}

	public String getPattern() {
			return pattern;
	}

	public Integer getDecimal() {
			return decimal;
	}
	
	public Field getReflect() {
			return reflect;
	}
	
	public void setReflect(Field reflect) {
			this.reflect = reflect;
	}

	/**
	 * 生成单元格存储对象
	 * @return
	 */
	public FieldValue newInstance(String value) {
			// TODO Auto-generated method stub
			return BasicClass.basic(value, this);
	}
	
}
